/********************************** (C) COPYRIGHT *******************************
* File Name          : main.c
* Author             : WCH
* Version            : V1.0.0
* Date               : 2021/08/08
* Description        : Main program body.
* Copyright (c) 2021 Nanjing Qinheng Microelectronics Co., Ltd.
* SPDX-License-Identifier: Apache-2.0
*******************************************************************************/

#include "debug.h"
#include "st7735s.h"

#include "lvgl.h"
#include "lv_port_disp.h"
#include "lv_port_indev.h"
#include "lv_apps\demo\demo.h"
#include "lv_tests\lv_test_theme\lv_test_theme_1.h"
#include "lv_tests\lv_test_theme\lv_test_theme_2.h"


void GPIO_Toggle_INIT( void )
{
    GPIO_InitTypeDef  GPIO_InitStructure = {0};

    RCC_APB2PeriphClockCmd( RCC_APB2Periph_GPIOC, ENABLE );
    GPIO_InitStructure.GPIO_Pin = GPIO_Pin_13;
    GPIO_InitStructure.GPIO_Mode = GPIO_Mode_Out_PP;
    GPIO_InitStructure.GPIO_Speed = GPIO_Speed_50MHz;
    GPIO_Init( GPIOC, &GPIO_InitStructure );
}
/*********************************************************************
 * @fn      main
 *
 * @brief   Main program.
 *
 * @return  none
 */

static lv_obj_t * scr;
static lv_style_t BackGround_style;
static lv_obj_t * CPUName_Lable;

int main(void)
{
	Delay_Init();
	USART_Printf_Init(115200);
	printf("SystemClk:%d\r\n",(int)SystemCoreClock);
	GPIO_Toggle_INIT();
    ST7735_Init();

    lv_init();
    lv_port_disp_init();
    scr = lv_scr_act();

    lv_style_copy(&BackGround_style,&lv_style_plain_color);
    BackGround_style.body.main_color = LV_COLOR_BLACK;
    BackGround_style.body.grad_color = LV_COLOR_BLACK;
    lv_obj_set_style(scr,&BackGround_style);

    CPUName_Lable = lv_label_create(scr,NULL);


    //lv_label_set_long_mode(CPUName_Lable,LV_LABEL_LONG_SROLL);
    lv_obj_set_width(CPUName_Lable,20);
    //lv_label_set_align(CPUName_Lable,LV_LABEL_ALIGN_CENTER);//??????ж???
    //lv_obj_align(CPUName_Lable,NULL,LV_ALIGN_IN_TOP_MID,0,2);

    lv_label_set_text(CPUName_Lable,"Oldwang ");
    lv_obj_set_pos(CPUName_Lable,10,50);




    while(1)
	{
        lv_task_handler();
        Delay_Ms(1);
//        GPIO_WriteBit( GPIOC, GPIO_Pin_13,  Bit_SET);
//        Delay_Ms( 500 );
//        GPIO_WriteBit( GPIOC, GPIO_Pin_13,  Bit_RESET);
//        Delay_Ms( 500 );
	}
}







